package com.gorkr.backtracking;

import org.junit.jupiter.api.Test;

import java.util.*;

/**
 * @author gorkr
 * @date 2022/09/14 15:16
 **/
public class M079SubSets {


    private List<List<Integer>> res = new LinkedList<>();

    LinkedList<Integer> trace = new LinkedList<>();

    public List<List<Integer>> subsets(int[] nums) {


        backTracking(nums,0);

        return res;
    }

    private void backTracking(int[] nums, int start) {

//        new PriorityQueue<>(new Comparator<Object>() {
//            @Override
//            public int compare(Object o1, Object o2) {
//                return 0;
//            }
//        })
//

        res.add(new ArrayList<>(trace));


        // 做选择
        for (int i = start; i < nums.length; i++) {
            trace.addLast(nums[i]);


            backTracking(nums, i+1);
            trace.removeLast();
        }
    }


    @Test
    public void test(){
        System.out.println(subsets(new int[]{1,2,3}).toString());

    }
}
    